package main.number;

import org.junit.Test;

import java.util.Random;

/**
 * Created by ChengGM on 2016/12/6.
 */
public class NumTest {
    @Test
    public void test(){
        int str =8;
        Random rm = new Random();

        // 获得随机数
        double pross = (1 + rm.nextDouble()) * Math.pow(10, str+1);

        // 将获得的获得随机数转化为字符串
        String fixLenthString = String.valueOf(pross);
        System.out.println(fixLenthString);
        // 返回固定的长度的随机数
        String result = fixLenthString.substring(2, str + 2);
        System.out.println(result);
    }
    @Test
    public void compareTest(){
//        int l = "abc".compareTo("b");
//        int l2 = "bc".compareTo("bd");
//        int l3 = "cad".compareTo("bcd");
//        System.out.println(l+">>>"+l2+">>>"+l3);
        Long a=4L;
        Long b=5L;
        int t = a.compareTo(b);
        System.out.println(t);
    }
    @Test
    public void numCompareTest(){
        Long a = new Long(1L);
        boolean flag = a.toString().equals(new Integer(1).toString());
        System.out.println("------->"+flag);
    }

    @Test
    public void test1() throws Exception {
        Integer a = new Integer(6);
        Integer b = (a-1)*new Integer(3);
        System.out.println("-------->"+b);
    }

    @Test
    public void test3() throws Exception {
        Long a = 900000000L;
        String b = String.valueOf(PriceUtil.parseFen2Yuan(a));
        System.out.println(PriceUtil.parseFen2Yuan(a));
    }

}
